package com.kodin.webview;

import android.webkit.JavascriptInterface;

import com.blankj.utilcode.util.LogUtils;

public class AndroidToJs {
    private String TAG = this.getClass().getSimpleName();
    private OnJs onJs;

    public AndroidToJs(OnJs aOnJs) {
        this.onJs = aOnJs;
    }

    // 关闭界面
    @JavascriptInterface
    public void closeWin() {
        LogUtils.e(TAG);
        onJs.closeWindow();
    }

    // 退出app
    @JavascriptInterface
    public void closeApp() {
        LogUtils.e(TAG);
        onJs.closeApp();
    }
    // 删除一张图片

    @JavascriptInterface
    public void deleteImage(String count) {
        LogUtils.e(TAG);
        onJs.deleteImage(count);
    }

    @JavascriptInterface
    public void startNewWebView(String url) {
        LogUtils.e(TAG);
        onJs.startNewWebView(url);
    }

    public interface OnJs {
        void closeWindow();

        void closeApp();

        void deleteImage(String count);

        void startNewWebView(String url);
    }
}
